package com.autumn.config;

import org.springframework.boot.Banner;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.config.server.EnableConfigServer;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

import com.autumn.config.consts.ConfigurePackageConsts.PackagePathConsts;
import com.autumn.dubbo.spring.boot.annotation.EnableDubboConfiguration;
import com.autumn.log.client.EnableAutumnLoggingClient;
import com.autumn.mq.rabbit.annotation.AutumnRabbitConnection;
import com.autumn.mq.rabbit.annotation.EnableAutumnRabbit;
import com.autumn.mybatis.annotation.EnableAutumnMybatis;
import com.autumn.redis.EnableAutumnRedis;
import com.autumn.spring.boot.annotation.EnableAutoAutumnConfiguration;
import com.autumn.spring.boot.properties.PropertiesConstant;
import com.autumn.web.security.AbstractAutumnSecurityApplication;

/**
 * 配置服务器应用
 *
 * @author 老码农
 * <p>
 * 2017-11-22 12:52:06
 */
@Configuration
@ComponentScan({PackagePathConsts.SCAN_PACKAGE_PATH})
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
@EnableAutumnMybatis(value = {
        PackagePathConsts.INTERFACE_PACKAGE_PATH}, typeAliasesPackages = PackagePathConsts.ENTITIE_PACKAGE_PATH)
@EnableAutumnRabbit(value = {@AutumnRabbitConnection(eventDataPackages = {
        "com.autumn.config.mq"}, eventHandlerPackages = {}, propertiesPrefix = PropertiesConstant.AUTUMN_MESSAGE_RABBIT_MQ_PROPERTIES_PREFIX)})
@EnableConfigServer
@EnableAutumnRedis
@EnableAutoAutumnConfiguration
@EnableDubboConfiguration
@EnableAutumnLoggingClient
@EnableEurekaClient
public class ConfigServerApplication extends AbstractAutumnSecurityApplication {

    public static void main(String[] args) {
        //SpringApplication.run(ConfigServerApplication.class, args);
        run(ConfigServerApplication.class, Banner.Mode.CONSOLE, args);
    }
}
